﻿
namespace CivilRegistry.ControlledModel
{
    /// <summary>
    /// A partial implementation of civil registry entities.
    /// </summary>
    public partial class CivilRegistryEntities
    {
        /// <summary>
        /// Holds the singleton <see cref="CivilRegistryEntities"/> instance.
        /// </summary>
        private static CivilRegistryEntities instance;

        /// <summary>
        /// An object to hold the lock.
        /// </summary>
        private static readonly object singletonLock = new object();

        /// <summary>
        /// Gets an singlton instance of <see cref="CivilRegistryEntities"/>.
        /// </summary>
        public static CivilRegistryEntities Instance
        {
            get 
            {
                lock (singletonLock)
                {
                    if (instance == null)
                    {
                        instance = new CivilRegistryEntities();
                    }
                    return instance;
                }
            }
        }
    }
}
